home *** CD-ROM | disk | FTP | other *** search
/ Delphi Magazine Collection 2001 / Delphi Magazine Collection 20001 (2001).iso / DISKS / Issue37 / Clinic / OtherU.pas < prev    next >
Encoding:
Pascal/Delphi Source File  |  1998-08-17  |  877 b   |  39 lines

  1. unit OtherU;
  2.  
  3. interface
  4.  
  5. uses
  6.   WinProcs, WinTypes, Messages, SysUtils, Classes, Graphics, Controls, Forms,
  7.   Dialogs, StdCtrls;
  8.  
  9. type
  10.   TOtherForm = class(TForm)
  11.     Label1: TLabel;
  12.     procedure FormClose(Sender: TObject; var Action: TCloseAction);
  13.   private
  14.     procedure CreateParams(var Params: TCreateParams); override;
  15.   end;
  16.  
  17. implementation
  18.  
  19. {$R *.DFM}
  20.  
  21. procedure TOtherForm.CreateParams(var Params: TCreateParams);
  22. begin
  23.   inherited CreateParams(Params);
  24.   Params.WndParent := HWnd_Desktop
  25. end;
  26.  
  27. procedure TOtherForm.FormClose(Sender: TObject; var Action: TCloseAction);
  28. begin
  29.   { If the only forms left are this one }
  30.   { being closed and the main form... }
  31.   if Screen.FormCount = 2 then
  32.     { ...then close the main form }
  33.     Application.MainForm.Close;
  34.   { Ensure this form is destroyed ASAP }
  35.   Action := caFree;
  36. end;
  37.  
  38. end.
  39.